/**
 * 
 */
package com.vector.ding.commons.util;

import java.math.BigDecimal;

/**
 * @author vector
 *
 */
public class NumberUtil {

	// no able to instance
	private NumberUtil() {
		
	}
	
	public static BigDecimal getBigDecimal(Object value) {
		String stringValue = StringUtil.getString(value);
		if (StringUtil.isEmpty(stringValue))
			return null;
		
		try {
			return new BigDecimal(stringValue);
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
	
	public static Integer getIntValue(Object value) {
		String stringValue = StringUtil.getString(value);
		if (StringUtil.isEmpty(stringValue))
			return null;
		
		try {
			return Integer.parseInt(stringValue.trim());
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
}
